package cn.tedu.csmall.stock.webapi.quartz;

import cn.tedu.csmall.stock.webapi.utils.RedisBloomUtils;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.springframework.beans.factory.annotation.Autowired;

import java.time.LocalDateTime;

public class QuartzJob implements Job {

    @Autowired
    private RedisBloomUtils redisBloomUtils;

    @Override
    public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
        System.out.println("-------------"+ LocalDateTime.now() +"-----------------");

        // 现将要添加到布隆过滤器的元素保存在一个数组中
        String[] colors = {"red","origin","yellow","green"};
        //
        redisBloomUtils.bfmadd("color", colors);
        String elm="green";
        System.out.println("布隆过滤器判断"+ elm +"是否在集合中:"+redisBloomUtils.bfexists("color",elm));


    }
}
